import { Base } from '../../utils/base.js';
class Model extends Base {
  constructor() {
    super();
  }

  // 获取列表
  getList(data,callback) {
    this.request({
      url: '/products',
      data,
      success: function (res) {
        callback && callback(res)
      }
    })
  }
  
  // 获取详细
  getInfo(id,callback){
    this.request({
      url: '/product/'+id,
      success: function (res) {
        callback && callback(res)
      },
      fail: function (res) {
        callback && callback(res)
      }
    })
  }

  // 收藏产品
  storeUserProducts(data, callback) {
    this.request({
      type: 'POST',
      url: '/set_store',
      data: data,
      success: function (res) {
        callback && callback(res)
      },
      fail: function (res) {
        wx.showToast({
          title: res.data.msg,
          icon: 'none'
        });
      }
    })
  }


}
export { Model }  